package com.yfqy.app.service;

import com.yfqy.app.constant.GeneralConstants;
import com.yfqy.app.enums.ErrorCode;
import com.yfqy.app.exception.BusinessException;
import com.yfqy.app.util.AuthUserContext;
import org.springframework.stereotype.Service;

@Service
public class UserService {

    protected Long getUserId() {
        Long userId = AuthUserContext.getUserId();
        if (userId == null || GeneralConstants.DEFAULT_USER_ID.equals(userId)) {
            throw new BusinessException(ErrorCode.USER_NOT_LOGIN);
        }
        return userId;
    }
}
